<%@ Control Language="C#" AutoEventWireup="true" CodeFile="_URLSecurityList.ascx.cs" Inherits="admin_webparts_URLSecurity_URLSecurityList" %>
<%@ Import Namespace="NTTHAO.Common.BL" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {
    NTTHAO.gridview.init('tbGrid2');
});
</script>
<div class="tip">
	<h1><%=LanguageUtility.GetLanguageText("PERMISSION_BY_URL", Session)%></h1>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
        <td align="left" style="padding-bottom: 10px;">
            <span id="addLink" class="yui-button yui-link-button"><span class="first-child"><a href="?type=ser&action=add" tabindex="0" id="loggerLink-button"><%=LanguageUtility.GetLanguageText("ADD_NEW", Session)%></a></span></span>
            <script type="text/javascript">
                YAHOO.util.Event.onContentReady("addLink", function () {
                        var oAddLink = new YAHOO.widget.Button("addLink");
                    });
            </script>
        </td>
    </tr>
    <tr>
        <td align="left">
            <table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid">
                <tr>
                    <th width="42px">#</th>
                    <th><%=LanguageUtility.GetLanguageText("URL", Session)%></th>
                    <th><%=LanguageUtility.GetLanguageText("DESCRIPTION", Session)%></th>
                    <th><%=LanguageUtility.GetLanguageText("ADMIN_USER", Session)%></th>
                    <th><%=LanguageUtility.GetLanguageText("EDITABLE", Session)%></th>
                    <th><%=LanguageUtility.GetLanguageText("LAST_UPDATE", Session)%></th>
                    <th width="42px"><%=LanguageUtility.GetLanguageText("EDIT", Session)%></th>
                </tr>
                <% if (this._URLList != null) for (int i = 0; i < this._URLList.Rows.Count; i++)
                   {
                       System.Data.DataRow row = this._URLList.Rows[i];
                       %>
                <tr class="<%=(i%2==1?"even":"odd") %>">
                    <td align="center"><%=i + 1 %></td>
                    <td><b><%=row[URLMap.URL__COLUMN_NAME] %></b></td>
                    <td align="left"><%=row[URLMap.DESCRIPTION__COLUMN_NAME]%></td>
                    <td align="left">
                       <%
                        URLMap urlMap = new URLMap();
                        URLSecurity[] listUser = urlMap.GetAllUserPermission((int)row[URLMap.ID__COLUMN_NAME]);
                        if (listUser != null)
                        {
                            for (int j = 0; j < listUser.Length; j++)
                            {
                                if (!listUser[j].UserName.Equals("admin"))
                                {
                        %>
                           <%=listUser[j].UserName + (j < listUser.Length - 1 ? ", " : "")%>
                        <%
                                }
                            }
                        }
                       %>
                    </td>
                    <td align="center"><%=((1 == (int)row[URLMap.EDITABLE__COLUMN_NAME]) ? "<img src=\"Resources/images/b_usrcheck.png\">" : "&nbsp;")%></td>
                    <td align="center"><%=((DateTime)row[URLMap.LASTUPDATE__COLUMN_NAME]).ToString("yyyy/MM/dd HH:mm")%></td>
                    <td align="center">
                        <ul class="icon" style="width: 28px;">
                            <li><a title="<%=LanguageUtility.GetLanguageText("EDIT", Session)%>" href="?type=ser&id=<%=row[URLMap.ID__COLUMN_NAME] %>&action=edit" class="icon editbn">&nbsp</a></li>
                        </ul>
                    </td>
                </tr>
                <%} %>
            </table>
        </td>
    </tr>
</table>
<div class="tip" style="margin-top: 10px;">
	<h1><%=LanguageUtility.GetLanguageText("PERMISSION_BY_USER", Session)%></h1>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid2">
    <tr>
        <th width="42px">#</th>
        <th><%=LanguageUtility.GetLanguageText("USERNAME", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("USER_TYPE", Session)%></th>
        <th width="42px"><%=LanguageUtility.GetLanguageText("EDIT", Session)%></th>
    </tr>
    <% 
        int index = -1;
        if (this._UserList != null) for (int i = 0; i < this._UserList.Rows.Count; i++)
           {
               System.Data.DataRow row = this._UserList.Rows[i];
               if ((0 != (byte)row[AdminUser.TYPE__COLUMN_NAME]))
               {
                   index++;
           %>
    <tr class="<%=(index%2==1?"even":"odd") %>">
        <td align="center"><%=index + 1%></td>
        <td align="center"><b><%=row[AdminUser.USERNAME__COLUMN_NAME]%></b></td>
        <td align="center"><%=((0 == (byte)row[AdminUser.TYPE__COLUMN_NAME]) ? LanguageUtility.GetLanguageText("USER_TYPE_ADMIN", Session) : LanguageUtility.GetLanguageText("USER_TYPE_NOMAL", Session))%></td>
        <td align="center">
            <ul class="icon" style="width: 28px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("EDIT", Session)%>" href="?type=ser&userid=<%=row[AdminUser.ID__COLUMN_NAME] %>&action=edituser" class="icon editbn">&nbsp</a></li>
            </ul>
        </td>
    </tr>
    <%}
  }%>
</table>